package com.parkinglot.service.Impl;

import com.parkinglot.dao.MonthbilRefundrDao;
import com.parkinglot.pojo.MonthbilRefundr;
import com.parkinglot.service.MonthbilRefundrService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (MonthbilRefundr)表服务实现类
 *
 * @author makejava
 * @since 2020-11-13 15:29:20
 */
@Service("monthbilRefundrService")
public class MonthbilRefundrServiceImpl implements MonthbilRefundrService {
    @Resource
    private MonthbilRefundrDao monthbilRefundrDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public MonthbilRefundr queryById(Integer id) {
        return this.monthbilRefundrDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<MonthbilRefundr> queryAllByLimit(int offset, int limit) {
        return this.monthbilRefundrDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param monthbilRefundr 实例对象
     * @return 实例对象
     */
    @Override
    public MonthbilRefundr insert(MonthbilRefundr monthbilRefundr) {
        this.monthbilRefundrDao.insert(monthbilRefundr);
        return monthbilRefundr;
    }

    /**
     * 修改数据
     *
     * @param monthbilRefundr 实例对象
     * @return 实例对象
     */
    @Override
    public MonthbilRefundr update(MonthbilRefundr monthbilRefundr) {
        this.monthbilRefundrDao.update(monthbilRefundr);
        return this.queryById(monthbilRefundr.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.monthbilRefundrDao.deleteById(id) > 0;
    }
}